#if !USE_CONSOLE

#include "src/interface/cameraPanel.h"

#include <iostream>

#include "src/defines/filterType.h"
#include "src/defines/antialiasingType.h"

#define MAX 5000

CameraPanel::CameraPanel(QWidget* _parent, Camera *_c) : QWidget(_parent), camera(_c){
    createLayout();
}

CameraPanel::~CameraPanel(){
    clear();
}

void CameraPanel::clear(){
    if(filterGaussianSigmaDoubleSpinBox) delete filterGaussianSigmaDoubleSpinBox;
    if(filterLaplacianNeighborhoodComboBox) delete filterLaplacianNeighborhoodComboBox;
    if(filterLaplacianNegativeComboBox) delete filterLaplacianNegativeComboBox;
    if(filterGaussianSigmaLabel) delete filterGaussianSigmaLabel;
    if(filterLaplacianNeighborhoodLabel) delete filterLaplacianNeighborhoodLabel;
    if(filterLaplacianNegativeLabel) delete filterLaplacianNegativeLabel;

    delete layout();
    qDeleteAll(children());
}

//void CameraPanel::updateCamera(){
//    camera->setEye(Vector3D(eyeX, eyeY, eyeZ));
//    camera->setLookAt(Vector3D(lookAtX, lookAtY, lookAtZ));
//    camera->setUp(Vector3D(upX, upY, upZ));
//    camera->setM(m);
//    camera->setN(n);
//    camera->setFocalDistance(f);
//
//    emit update();
//}

void CameraPanel::createLayout()
{

    Vector3D eye = camera->getEye();
    Vector3D lookAt = camera->getLookAt();
    Vector3D up = camera->getUp();
    double eyeX = eye.x;
    double eyeY = eye.y;
    double eyeZ = eye.z;
    double lookAtX = lookAt.x;
    double lookAtY = lookAt.y;
    double lookAtZ = lookAt.z;
    double upX = up.x;
    double upY = up.y;
    double upZ = up.z;
    int m = camera->getM();
    int n = camera->getN();
    int mPerPixel = mPerPixel_ = camera->getMPerPixel();
    int nPerPixel = nPerPixel_ = camera->getNPerPixel();
    double focalDistance = camera->getFocalDistance();
    double imagePlane = camera->getImagePlane();
    double zoom = camera->getZoom();
    double radius = camera->getRadius();
    bool depthOfField = camera->getDepthOfField();
    int antialiasingType = type_ = camera->getAntialiasingType();
    bool withAntialiasing = false;
    if(antialiasingType != 0)
    {
        withAntialiasing = true;
        antialiasingType = antialiasingType-1;
    }
    int filterType = camera->getFilterType();
    double filterGaussianSigma = camera->getFilterGaussianSigma();
    int filterLaplacianNeighborhood = camera->getFilterLaplacianNeighborhood();
    int filterLaplacianNegative = camera->getFilterLaplacianNegative();



    //------------------------------------------------------------Eye
    QLabel *eyeXLabel = new QLabel(tr("x:"));

    QDoubleSpinBox *eyeXDoubleSpinBox = new QDoubleSpinBox();
    eyeXDoubleSpinBox->setRange(-50.0, 50.0);
    eyeXDoubleSpinBox->setSingleStep(1.0);
    eyeXDoubleSpinBox->setValue(eyeX);
    connect(eyeXDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeEyeX(double)));


    QLabel *eyeYLabel = new QLabel(tr("y:"));

    QDoubleSpinBox *eyeYDoubleSpinBox = new QDoubleSpinBox();
    eyeYDoubleSpinBox->setRange(-50.0, 50.0);
    eyeYDoubleSpinBox->setSingleStep(1.0);
    eyeYDoubleSpinBox->setValue(eyeY);
    connect(eyeYDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeEyeY(double)));


    QLabel *eyeZLabel = new QLabel(tr("z:"));

    QDoubleSpinBox *eyeZDoubleSpinBox = new QDoubleSpinBox();
    eyeZDoubleSpinBox->setRange(-50.0, 50.0);
    eyeZDoubleSpinBox->setSingleStep(1.0);
    eyeZDoubleSpinBox->setValue(eyeZ);
    connect(eyeZDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeEyeZ(double)));


    QHBoxLayout *eyeLayout = new QHBoxLayout;
    eyeLayout->addWidget(eyeXLabel);
    eyeLayout->addWidget(eyeXDoubleSpinBox);
    eyeLayout->addStretch(1);
    eyeLayout->addWidget(eyeYLabel);
    eyeLayout->addWidget(eyeYDoubleSpinBox);
    eyeLayout->addStretch(1);
    eyeLayout->addWidget(eyeZLabel);
    eyeLayout->addWidget(eyeZDoubleSpinBox);
    eyeLayout->addStretch(1);

    QGroupBox *eyeGroupBox = new QGroupBox(QString::fromUtf8("Eye (ponto)"));
    eyeGroupBox->setLayout(eyeLayout);


    //------------------------------------------------------------LookAt
    QLabel *lookAtXLabel = new QLabel(tr("x:"));

    QDoubleSpinBox *lookAtXDoubleSpinBox = new QDoubleSpinBox();
    lookAtXDoubleSpinBox->setRange(-50.0, 50.0);
    lookAtXDoubleSpinBox->setSingleStep(1.0);
    lookAtXDoubleSpinBox->setValue(lookAtX);
    connect(lookAtXDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeLookAtX(double)));


    QLabel *lookAtYLabel = new QLabel(tr("y:"));

    QDoubleSpinBox *lookAtYDoubleSpinBox = new QDoubleSpinBox();
    lookAtYDoubleSpinBox->setRange(-50.0, 50.0);
    lookAtYDoubleSpinBox->setSingleStep(1.0);
    lookAtYDoubleSpinBox->setValue(lookAtY);
    connect(lookAtYDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeLookAtY(double)));


    QLabel *lookAtZLabel = new QLabel(tr("z:"));

    QDoubleSpinBox *lookAtZDoubleSpinBox = new QDoubleSpinBox();
    lookAtZDoubleSpinBox->setRange(-50.0, 50.0);
    lookAtZDoubleSpinBox->setSingleStep(1.0);
    lookAtZDoubleSpinBox->setValue(lookAtZ);
    connect(lookAtZDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeLookAtZ(double)));


    QHBoxLayout *lookAtLayout = new QHBoxLayout;
    lookAtLayout->addWidget(lookAtXLabel);
    lookAtLayout->addWidget(lookAtXDoubleSpinBox);
    lookAtLayout->addStretch(1);
    lookAtLayout->addWidget(lookAtYLabel);
    lookAtLayout->addWidget(lookAtYDoubleSpinBox);
    lookAtLayout->addStretch(1);
    lookAtLayout->addWidget(lookAtZLabel);
    lookAtLayout->addWidget(lookAtZDoubleSpinBox);
    lookAtLayout->addStretch(1);

    QGroupBox *lookAtGroupBox = new QGroupBox(QString::fromUtf8("LookAt (ponto)"));
    lookAtGroupBox->setLayout(lookAtLayout);




    //------------------------------------------------------------Up
    QLabel *upXLabel = new QLabel(tr("x:"));

    QDoubleSpinBox *upXDoubleSpinBox = new QDoubleSpinBox();
    upXDoubleSpinBox->setRange(-50.0, 50.0);
    upXDoubleSpinBox->setSingleStep(1.0);
    upXDoubleSpinBox->setValue(upX);
    connect(upXDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeUpX(double)));


    QLabel *upYLabel = new QLabel(tr("y:"));

    QDoubleSpinBox *upYDoubleSpinBox = new QDoubleSpinBox();
    upYDoubleSpinBox->setRange(-50.0, 50.0);
    upYDoubleSpinBox->setSingleStep(1.0);
    upYDoubleSpinBox->setValue(upY);
    connect(upYDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeUpY(double)));


    QLabel *upZLabel = new QLabel(tr("z:"));

    QDoubleSpinBox *upZDoubleSpinBox = new QDoubleSpinBox();
    upZDoubleSpinBox->setRange(-50.0, 50.0);
    upZDoubleSpinBox->setSingleStep(1.0);
    upZDoubleSpinBox->setValue(upZ);
    connect(upZDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeUpZ(double)));


    QHBoxLayout *upLayout = new QHBoxLayout;
    upLayout->addWidget(upXLabel);
    upLayout->addWidget(upXDoubleSpinBox);
    upLayout->addStretch(1);
    upLayout->addWidget(upYLabel);
    upLayout->addWidget(upYDoubleSpinBox);
    upLayout->addStretch(1);
    upLayout->addWidget(upZLabel);
    upLayout->addWidget(upZDoubleSpinBox);
    upLayout->addStretch(1);

    QGroupBox *upGroupBox = new QGroupBox(QString::fromUtf8("Up (vetor)"));
    upGroupBox->setLayout(upLayout);


    //------------------------------------------------------------ImagePlane
    QDoubleSpinBox *imagePlaneDoubleSpinBox = new QDoubleSpinBox();
    imagePlaneDoubleSpinBox->setRange(0.0, 50.0);
    imagePlaneDoubleSpinBox->setSingleStep(1.0);
    imagePlaneDoubleSpinBox->setValue(imagePlane);
    connect(imagePlaneDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeImagePlane(double)));

    QHBoxLayout *imagePlaneLayout = new QHBoxLayout;
    imagePlaneLayout->addWidget(imagePlaneDoubleSpinBox);
    imagePlaneLayout->addStretch(1);

    QGroupBox *imagePlaneGroupBox = new QGroupBox(QString::QString::fromUtf8("Plano da imagem"));
    imagePlaneGroupBox->setLayout(imagePlaneLayout);

    //------------------------------------------------------------Zoom
    QDoubleSpinBox *zoomDoubleSpinBox = new QDoubleSpinBox();
    zoomDoubleSpinBox->setRange(1.0, 5000.0);
    zoomDoubleSpinBox->setSingleStep(5.0);
    zoomDoubleSpinBox->setValue(zoom);
    connect(zoomDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeZoom(double)));

    QHBoxLayout *zoomLayout = new QHBoxLayout;
    zoomLayout->addWidget(zoomDoubleSpinBox);
    zoomLayout->addStretch(1);

    QGroupBox *zoomGroupBox = new QGroupBox(QString::QString::fromUtf8("Zoom"));
    zoomGroupBox->setLayout(zoomLayout);


    QHBoxLayout *zoomImagePlaneLayout = new QHBoxLayout;
    zoomImagePlaneLayout->addWidget(imagePlaneGroupBox);
    zoomImagePlaneLayout->addWidget(zoomGroupBox);
    zoomImagePlaneLayout->addStretch(1);


    //------------------------------------------------------------Grade
    QSpinBox *mSpinBox = new QSpinBox();
    mSpinBox->setRange(1, MAX);
    mSpinBox->setSingleStep(10.0);
    mSpinBox->setValue(m);
    connect(mSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeM(int)));

    QSpinBox *nSpinBox = new QSpinBox();
    nSpinBox->setRange(1, MAX);
    nSpinBox->setSingleStep(10.0);
    nSpinBox->setValue(n);
    connect(nSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeN(int)));


    QLabel *mLabel = new QLabel(tr("Largura:"));
    QLabel *nLabel = new QLabel(tr("Altura:"));

    QHBoxLayout *mnLayout = new QHBoxLayout;
    mnLayout->addWidget(mLabel);
    mnLayout->addWidget(mSpinBox);
    mnLayout->addWidget(nLabel);
    mnLayout->addWidget(nSpinBox);
    mnLayout->addStretch(1);

    QGroupBox *mnGroupBox = new QGroupBox(QString::fromUtf8("Grade"));
    mnGroupBox->setLayout(mnLayout);




    //------------------------------------------------ANTIALIASING
    //------------------------------------------------------------Mascara
    QSpinBox *mPerPixelSpinBox = new QSpinBox();
    mPerPixelSpinBox->setRange(1, MAX);
    mPerPixelSpinBox->setSingleStep(2);
    mPerPixelSpinBox->setValue(mPerPixel);
    connect(mPerPixelSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeMPerPixel(int)));
//    connect(this, SIGNAL(updateMPerPixel(int)), mPerPixelSpinBox, SLOT(setValue(int)));

    QSpinBox *nPerPixelSpinBox = new QSpinBox();
    nPerPixelSpinBox->setRange(1, MAX);
    nPerPixelSpinBox->setSingleStep(2);
    nPerPixelSpinBox->setValue(nPerPixel);
    connect(nPerPixelSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeNPerPixel(int)));
//    connect(this, SIGNAL(updateNPerPixel(int)), nPerPixelSpinBox, SLOT(setValue(int)));


    QLabel *mPerPixelLabel = new QLabel(tr("m:"));
    QLabel *nPerPixelLabel = new QLabel(tr("n:"));


    //------------------------------------------------------------Tipo
    QComboBox *antialiasingTypeComboBox = new QComboBox;
//    antialiasingTypeComboBox->addItem(tr("Sem anti-aliasing"));
    antialiasingTypeComboBox->addItem(tr("Regular"));
    antialiasingTypeComboBox->addItem(tr("Random"));
    antialiasingTypeComboBox->addItem(tr("Jittering"));
    antialiasingTypeComboBox->setCurrentIndex(antialiasingType);
    connect(antialiasingTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeAntialiasingType(int)));

    QHBoxLayout *antialiasingTypeLayout = new QHBoxLayout;
    antialiasingTypeLayout->addWidget(antialiasingTypeComboBox);
    antialiasingTypeLayout->addWidget(mPerPixelLabel);
    antialiasingTypeLayout->addWidget(mPerPixelSpinBox);
    antialiasingTypeLayout->addWidget(nPerPixelLabel);
    antialiasingTypeLayout->addWidget(nPerPixelSpinBox);



    //------------------------------------------------------------Filtro
    filterGaussianSigmaLabel = new QLabel(QString::fromUtf8("σ:"));
    filterGaussianSigmaLabel->hide();
    filterGaussianSigmaDoubleSpinBox = new QDoubleSpinBox();
    filterGaussianSigmaDoubleSpinBox->setRange(0.0, 50.0);
    filterGaussianSigmaDoubleSpinBox->setSingleStep(1.0);
    filterGaussianSigmaDoubleSpinBox->setValue(filterGaussianSigma);
    filterGaussianSigmaDoubleSpinBox->hide();
    connect(filterGaussianSigmaDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeFilterGaussianSigma(double)));

//    QHBoxLayout *filterGaussianSigmaLayout = new QHBoxLayout;
//    filterGaussianSigmaLayout->addWidget(filterGaussianSigmaLabel);
//    filterGaussianSigmaLayout->addWidget(filterGaussianSigmaDoubleSpinBox);
//    filterGaussianSigmaLayout->addStretch(1);

    filterLaplacianNeighborhoodLabel = new QLabel(QString::fromUtf8("Vizinhança:"));
    filterLaplacianNeighborhoodLabel->hide();
    filterLaplacianNeighborhoodComboBox = new QComboBox;
    filterLaplacianNeighborhoodComboBox->addItem(tr("4"));
    filterLaplacianNeighborhoodComboBox->addItem(tr("8"));
    filterLaplacianNeighborhoodComboBox->setCurrentIndex(filterLaplacianNeighborhood);
    filterLaplacianNeighborhoodComboBox->hide();
    connect(filterLaplacianNeighborhoodComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeFilterLaplacianNeighborhood(int)));

    filterLaplacianNegativeLabel = new QLabel(QString::fromUtf8("Centro:"));
    filterLaplacianNegativeLabel->hide();
    filterLaplacianNegativeComboBox = new QComboBox;
    filterLaplacianNegativeComboBox->addItem(tr("-"));
    filterLaplacianNegativeComboBox->addItem(tr("+"));
    filterLaplacianNegativeComboBox->setCurrentIndex(filterLaplacianNegative);
    filterLaplacianNegativeComboBox->hide();
    connect(filterLaplacianNegativeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeFilterLaplacianNegative(int)));


    QHBoxLayout *filterOptionsLayout = new QHBoxLayout;
    filterOptionsLayout->addWidget(filterLaplacianNeighborhoodLabel);
    filterOptionsLayout->addWidget(filterLaplacianNeighborhoodComboBox);
//    filterOptionsLayout->addStretch(1);
    filterOptionsLayout->addWidget(filterLaplacianNegativeLabel);
    filterOptionsLayout->addWidget(filterLaplacianNegativeComboBox);
//    filterOptionsLayout->addStretch(1);
    filterOptionsLayout->addStretch(1);

    QLabel *filterTypeLabel = new QLabel(QString::fromUtf8("Filtro: "));
    QComboBox *filterTypeComboBox = new QComboBox;
    filterTypeComboBox->addItem(QString::fromUtf8("Média"));
    filterTypeComboBox->addItem(tr("Gaussiano"));
    filterTypeComboBox->addItem(tr("Laplaciano"));
    filterTypeComboBox->addItem(QString::fromUtf8("Média ponderada"));
    filterTypeComboBox->setCurrentIndex(filterType);
    connect(filterTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeFilterType(int)));

    QHBoxLayout *filterTypeLayout = new QHBoxLayout;
    filterTypeLayout->addWidget(filterTypeLabel);
    filterTypeLayout->addWidget(filterTypeComboBox);
	filterTypeLayout->addStretch(1);
    filterTypeLayout->addWidget(filterGaussianSigmaLabel);
    filterTypeLayout->addWidget(filterGaussianSigmaDoubleSpinBox);
    filterTypeLayout->addStretch(1);

    QVBoxLayout *antialiasingLayout = new QVBoxLayout;
    antialiasingLayout->addLayout(antialiasingTypeLayout);
    antialiasingLayout->addLayout(filterTypeLayout);
    antialiasingLayout->addLayout(filterOptionsLayout);
    antialiasingLayout->addStretch(1);


    QGroupBox *antialiasingGroupBox = new QGroupBox(QString::fromUtf8("Anti-aliasing"));
    antialiasingGroupBox->setCheckable(true);
    antialiasingGroupBox->setChecked(withAntialiasing);
    antialiasingGroupBox->setLayout(antialiasingLayout);
    connect(antialiasingGroupBox, SIGNAL(toggled(bool)), this, SLOT(activateAntialiasing(bool)));



    //--------------------------------------------------DEPTH OF FIELD
    //------------------------------------------------------------FocalDistance

    QLabel *focalDistanceLabel = new QLabel(QString::fromUtf8("Distância focal: "));
    QDoubleSpinBox *focalDistanceDoubleSpinBox = new QDoubleSpinBox();
    focalDistanceDoubleSpinBox->setRange(0.0, 50.0);
    focalDistanceDoubleSpinBox->setSingleStep(1.0);
    focalDistanceDoubleSpinBox->setValue(focalDistance);
    connect(focalDistanceDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeFocalDistance(double)));

    QHBoxLayout *focalDistanceLayout = new QHBoxLayout;
    focalDistanceLayout->addWidget(focalDistanceLabel);
    focalDistanceLayout->addWidget(focalDistanceDoubleSpinBox);
    focalDistanceLayout->addStretch(1);


    //------------------------------------------------------------FocalDistance
    QLabel *radiusLabel = new QLabel(QString::fromUtf8("Raio: "));
    QDoubleSpinBox *radiusDoubleSpinBox = new QDoubleSpinBox();
    radiusDoubleSpinBox->setRange(0.0, 10.0);
    radiusDoubleSpinBox->setSingleStep(0.1);
    radiusDoubleSpinBox->setValue(radius);
    connect(radiusDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(changeRadius(double)));

    QHBoxLayout *radiusLayout = new QHBoxLayout;
    radiusLayout->addWidget(radiusLabel);
    radiusLayout->addWidget(radiusDoubleSpinBox);
    radiusLayout->addStretch(1);



    QVBoxLayout *depthOfFieldLayout = new QVBoxLayout;
    depthOfFieldLayout->addLayout(focalDistanceLayout);
    depthOfFieldLayout->addLayout(radiusLayout);
    depthOfFieldLayout->addStretch(1);


    QGroupBox *depthOfFieldGroupBox = new QGroupBox(QString::fromUtf8("Depth of Field"));
    depthOfFieldGroupBox->setCheckable(true);
    depthOfFieldGroupBox->setChecked(depthOfField);
    depthOfFieldGroupBox->setLayout(depthOfFieldLayout);
    connect(depthOfFieldGroupBox, SIGNAL(toggled(bool)), this, SLOT(activateDepthOfField(bool)));


    //------------------------------------------------------------
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(eyeGroupBox);
    layout->addWidget(lookAtGroupBox);
    layout->addWidget(upGroupBox);
    layout->addLayout(zoomImagePlaneLayout);
    layout->addWidget(mnGroupBox);
    layout->addWidget(antialiasingGroupBox);
    layout->addWidget(depthOfFieldGroupBox);
	layout->addStretch(1);

    setLayout(layout);
}

void CameraPanel::changeEyeX(double _x){
    camera->setEyeX(_x);
    emit update();
}

void CameraPanel::changeEyeY(double _y){
    camera->setEyeY(_y);
    emit update();
}

void CameraPanel::changeEyeZ(double _z){
    camera->setEyeZ(_z);
    emit update();
}

void CameraPanel::changeLookAtX(double _x){
    camera->setLookAtX(_x);
    emit update();
}

void CameraPanel::changeLookAtY(double _y){
    camera->setLookAtY(_y);
    emit update();
}

void CameraPanel::changeLookAtZ(double _z){
    camera->setLookAtZ(_z);
    emit update();
}

void CameraPanel::changeUpX(double _x){
    camera->setUpX(_x);
    emit update();
}

void CameraPanel::changeUpY(double _y){
    camera->setUpY(_y);
    emit update();
}

void CameraPanel::changeUpZ(double _z){
    camera->setUpZ(_z);
    emit update();
}

void CameraPanel::changeM(int _m){
    camera->setM(_m);
    emit update();
}

void CameraPanel::changeN(int _n){
    camera->setN(_n);
    emit update();
}

void CameraPanel::changeMPerPixel(int _m){
    camera->setMPerPixel(_m);
    mPerPixel_ = _m;
}

void CameraPanel::changeNPerPixel(int _n){
    camera->setNPerPixel(_n);
    nPerPixel_ = _n;
}

void CameraPanel::changeFocalDistance(double _f){
    camera->setFocalDistance(_f);
    emit update();
}

void CameraPanel::changeImagePlane(double _i){
    camera->setImagePlane(_i);
    emit update();
}

void CameraPanel::changeZoom(double _z){
    camera->setZoom(_z);
    emit update();
}

void CameraPanel::changeRadius(double _r){
    camera->setRadius(_r);
    emit update();
}

void CameraPanel::activateDepthOfField(bool _b){
    camera->setDepthOfField(_b);
    emit update();
}

void CameraPanel::activateAntialiasing(bool _b){
    if(!_b)
    {
        camera->setAntialiasingType(0);
        camera->setMPerPixel(1);
        camera->setNPerPixel(1);
    }
    else
    {
        camera->setAntialiasingType(type_ + 1);
        camera->setMPerPixel(mPerPixel_);
        camera->setNPerPixel(nPerPixel_);
    }
}

void CameraPanel::changeAntialiasingType(int _t){
//    emit updateMPerPixel(mPerPixel);
//    emit updateNPerPixel(nPerPixel);
    camera->setAntialiasingType(_t + 1);
    type_ = _t;
}

void CameraPanel::changeFilterType(int _t)
{
//    bool b1 = (_t == GAUSSIAN);
//    bool b2 = (_t == LAPLACIAN);
//    filterGaussianSigmaDoubleSpinBox->setEnabled(b1);
//    filterGaussianSigmaLabel->setEnabled(b1);
//    filterLaplacianNeighborhoodComboBox->setEnabled(b2);
//    filterLaplacianNegativeComboBox->setEnabled(b2);
//    filterLaplacianNeighborhoodLabel->setEnabled(b2);
//    filterLaplacianNegativeLabel->setEnabled(b2);
    if(_t == GAUSSIAN)
    {
        filterGaussianSigmaDoubleSpinBox->show();
        filterGaussianSigmaLabel->show();
    }
    else
    {
        filterGaussianSigmaDoubleSpinBox->hide();
        filterGaussianSigmaLabel->hide();
    }

    if(_t == LAPLACIAN)
    {
        filterLaplacianNeighborhoodComboBox->show();
        filterLaplacianNegativeComboBox->show();
        filterLaplacianNeighborhoodLabel->show();
        filterLaplacianNegativeLabel->show();

    }
    else
    {
        filterLaplacianNeighborhoodComboBox->hide();
        filterLaplacianNegativeComboBox->hide();
        filterLaplacianNeighborhoodLabel->hide();
        filterLaplacianNegativeLabel->hide();

    }
    camera->setFilterType(_t);
}

void CameraPanel::changeFilterGaussianSigma(double _s){
    camera->setFilterGaussianSigma(_s);
}

void CameraPanel::changeFilterLaplacianNeighborhood(int _nb){
    camera->setFilterLaplacianNeighborhood(_nb);
}

void CameraPanel::changeFilterLaplacianNegative(int _ng){
    camera->setFilterLaplacianNegative(_ng);
}
#endif //!USE_CONSOLE
